package com.xingkeduo.util.pojo.base;

import java.util.Date;

import com.xingkeduo.util.pojo.enums.YesNoEnum;

/**
 * 数据库表基类
 * 
 * @author GJ
 * @time 2017年12月18日 上午10:27:14
 * @description
 */
public class BaseTable<T extends BaseTable<T>> {
	protected long id;
	protected long code;
	protected YesNoEnum isDelete;
	protected int version;
	protected long createdBy;
	protected Date createdTime;
	protected long updatedBy;
	protected Date updatedTime;

	public T initId(long id) {
//		StringBuffer sb = new StringBuffer(new SimpleDateFormat("yyyyMMdd").format(new Date())).append(id);
		this.code = id;
		this.id = id;
//		this.id = Long.parseLong(sb.toString());
		return (T) this;
	}

	public long getId() {
		return id;
	}

	public T setId(long id) {
		this.id = id;
		return (T) this;
	}

	public long getCode() {
		return code;
	}

	public T setCode(long code) {
		this.code = code;
		return (T) this;
	}

	public YesNoEnum getIsDelete() {
		return isDelete;
	}

	public T setIsDelete(YesNoEnum isDelete) {
		this.isDelete = isDelete;
		return (T) this;
	}

	public int getVersion() {
		return version;
	}

	public T setVersion(int version) {
		this.version = version;
		return (T) this;
	}

	public long getCreatedBy() {
		return createdBy;
	}

	public T setCreatedBy(long createdBy) {
		this.createdBy = createdBy;
		return (T) this;
	}

	public Date getCreatedTime() {
		return createdTime;
	}

	public T setCreatedTime(Date createdTime) {
		this.createdTime = createdTime;
		return (T) this;
	}

	public long getUpdatedBy() {
		return updatedBy;
	}

	public T setUpdatedBy(long updatedBy) {
		this.updatedBy = updatedBy;
		return (T) this;
	}

	public Date getUpdatedTime() {
		return updatedTime;
	}

	public T setUpdatedTime(Date updatedTime) {
		this.updatedTime = updatedTime;
		return (T) this;
	}
}
